package com.fw.config;

import java.util.ArrayList;
import java.util.List;

import com.fw.aop.Interceptor;

public final class Interceptors {

	private final List<Interceptor> interceptorList = new ArrayList<Interceptor>();

	public Interceptors add(Interceptor globalInterceptor) {
		if (globalInterceptor != null) {
			this.interceptorList.add(globalInterceptor);
		}
		return this;
	}

	public Interceptor[] getInterceptorArray() {
		Interceptor[] result = interceptorList.toArray(new Interceptor[interceptorList.size()]);
		return result == null ? new Interceptor[0] : result;
	}
}
